package com.toe.recommend.webapi.app;

import com.toe.recommend.service.RecommendClassesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CachePreLoad implements ApplicationRunner {

    @Autowired
    private RecommendClassesService service;

    @Override
    public void run(ApplicationArguments args) {
        System.out.println("CachePreLoad.run()");
        log.debug("准备执行缓存预热……");

        service.preloadCache();

        log.debug("缓存预热完成！");
    }

}
